import { createApp } from 'vue'
import App from './App.vue'
import router from './router/router'
import store from './store/store'
import { ElButton, ElInput, ElForm, ElFormItem } from 'element-plus'
import 'element-plus/dist/index.css'
import Nprogress from "nprogress"
import "nprogress/nprogress.css"
import axios from 'axios'
// import locale from 'element-plus/lib/locale/lang/zh-cn.js'
// import axios from './utils/request'

axios.defaults.baseURL = import.meta.env.VITE_APP_URL;
axios.interceptors.request.use((config) => {
    config.headers.Authorization = "Bearer "+localStorage.getItem("token")
    Nprogress.start();
    return config
})
axios.interceptors.response.use((config) => {
    Nprogress.done();
    return config
})
const app = createApp(App)
//全局挂载axios
app.config.globalProperties.$axios = axios;

//使用路由
app.use(router)
app.use(store)
app.use(ElButton)
app.use(ElForm)
app.use(ElFormItem)
app.use(ElInput)
app.mount('#app')